namespace QueryBuilder.Core.Query
{
    /// <summary>
    /// 
    /// </summary>
    public class Aggregate : Constraint
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="Aggregate"/> class.
        /// </summary>
        /// <param name="aggregateType">Type of the aggregate.</param>
        /// <param name="alias">The alias.</param>
        /// <param name="column">The column.</param>
        public Aggregate(string aggregateType, string alias, IColumn column)
        {
            this.AggregateType = aggregateType;
            this.Alias = alias;
            this.Column = column;
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="Aggregate"/> class.
        /// </summary>
        /// <param name="aggrigateType">Type of the aggrigate.</param>
        /// <param name="column">The column.</param>
        public Aggregate(string aggrigateType, IColumn column)
        {
            this.AggregateType = aggrigateType;
            this.Column = column;
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="Aggregate"/> class.
        /// </summary>
        /// <param name="aggrigateType">Type of the aggrigate.</param>
        public Aggregate(string aggrigateType)
        {
            this.AggregateType = aggrigateType;
        }

        /// <summary>
        /// Gets or sets the type of the aggregate.
        /// </summary>
        /// <value>The type of the aggregate.</value>
        public string AggregateType { get; set; }

        /// <summary>
        /// Gets or sets the alias.
        /// </summary>
        /// <value>The alias.</value>
        public string Alias { get; set; }
        
        /// <summary>
        /// Gets or sets the column.
        /// </summary>
        /// <value>The column.</value>
        public IColumn Column { get; set; }

        /// <summary>
        /// Gets or sets a value indicating whether this instance is all fields.
        /// </summary>
        /// <value>
        /// 	<c>true</c> if this instance is all fields; otherwise, <c>false</c>.
        /// </value>
        public bool IsAllFields { get; set; }

        /// <summary>
        /// Accepts the specified constraint presenter.
        /// </summary>
        /// <param name="constraintPresenter">The constraint presenter.</param>
        public override void Accept(IConstraintPresenter constraintPresenter)
        {
            constraintPresenter.Present(this);
        }
    }
}